<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>套餐选择界面</title>
<%@include file="../include/include.jsp"%>
<link rel="stylesheet" type="text/css" href="${csspath }/public.css"/>
<link rel="stylesheet" type="text/css" href="${csspath }/datepicker.css"/>
<link rel="stylesheet" type="text/css" href="${csspath }/style_l.css"/>
<script type="text/javascript" src="${jspath }/jquery/jquery-1.8.3.js"></script>
<script type="text/javascript" src="${layerPath}/layer.js"></script>
<script type="text/javascript" src="${jspath }/jquery.ui.min.js"></script>
<script type="text/javascript" src="${jspath }/ui.datepicker_zh-CN.js"></script>
<script type="text/javascript" src="${jspath }/jquery.blockUI.js"></script>
<script type="text/javascript" src="${jspath }/public.js"></script>
<script type="text/javascript" src="${jspath }/jquery.selectAll.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.ui.draggable.js"></script>
<script type="text/javascript" src="${jspath}/jquery/jquery.alerts.js"></script>
<link rel="stylesheet" type="text/css" href="${csspath}/jquery.alerts.css" />
<script type="text/javascript" src="${jspath}/load_layer.js"></script>
<link rel="stylesheet" type="text/css"
	href="${webcontext}/css/validationEngine.jquery.css" />
<script src="${jspath}/jquery/validate/jquery.validationEngine.js"
	type="text/javascript"></script>
<script src="${jspath}/jquery/validate/jquery.validationEngine-zh.js"
	type="text/javascript"></script>
	<script type="text/javascript"
	src="${webcontext}/javascript/jquery/jquery.ui.draggable.js"></script>
<link rel="stylesheet" type="text/css"
	href="${bootstrapPath}/css/bootstrap.css" />
<script type="text/javascript" src="${bootstrapPath}/js/bootstrap.js"></script>
<style type="text/css">
.formError .formErrorContent {
    -moz-border-radius: 6px 6px 6px 6px;
    -moz-box-shadow: 0 0 6px #000000;
    background: none repeat scroll 0 0 #EE0101;
    border: 2px solid #DDDDDD;
    color: #FFFFFF;
    font-family: tahoma;
    font-size: 11px;
    padding: 4px 10px;
    width: 100px;
}

#edit_purchase{
	border: 1px solid #ebebeb;
}

.input_tab { table-layout:fixed; }

.data_tab{
	border: 0 solid #fff;
}
.data_tab th{
	background: #fff url("");
	color: #000;
}

.data_tab tr.over td, .data_tab tr.over td a{
	background-color: #fff;
	color: #000;
	font-weight: normal;
}
.checkbox-li {
	display: inline-block;
	width: 300px;
}
html {
    overflow-y: auto;
}
</style>
<script type="text/javascript">
$(function(){
	$("#submitSetting").click(
		function(){
			var s = "";
			$('input[type=checkbox]').each(function(){
		        var self=$(this);
		        if(self.prop('checked')){
		        	s += self.val()+',';
		        }
		    });
			$.ajax({
				url : '${webcontext}/crmdp/dealer/meal/savePackageSelect?parm=' + s + '&dealerId=' + $("#thisDealerId").val(),
				type : 'post',
				success : function(data) {
					if(data){
						jAlert("保存成功", "提示");
					}else{
						jAlert("保存失败，请重试", "提示");
					}
				},
				error : function() {
					jAlert("服务器错误，请联系管理员", "提示");
				}
			});	
		});
});
function allCheck(){
	$('input[type=checkbox]').each(function(){
        var self=$(this);
        self.prop('checked',true);
    });
}
function noneCheck(){
	$('input[type=checkbox]').each(function(){
        var self=$(this);
        self.prop('checked',false);
    });
}
</script>

</head>
<body>
	<div id="content" style="height: 100%;">
		<div class="spliter h_10"></div>
		<form id="form" class="" action="#" method="post">
				<input id="thisDealerId" type="hidden" value="${dealerId}">
			<div class="form-group" style="border-bottom: 2px solid #ddd;margin-bottom: 5px;">
				<label for="packageForSelect" style=" font-size: larger;">请选择您的在售套餐</label>
			</div>
			<div class="form-group">
				<core:forEach items="${packageDefinitionListDto}" var="list">
					<div class="form-group" style="margin-bottom: 5px;">
						<label for="packageForSelect">${list.cardType}</label>
					</div>
					<div class="checkbox "
					style="display: inline-block; margin-left: 50px;">
					<ul>
						<core:forEach items="${list.packageDefinitionResultsDtoList}" var="packageList">
							<core:if test="${packageList.id != -1}">
								<li class="checkbox-li" style="line-height:30px; margin-right: 30px;height:30px;">
									<input type="checkbox" name="checkbox" <core:if test="${packageList.ifChecked == 1}">checked</core:if> value="${packageList.id}" >
									<input type="hidden" name="packageDefId" value="${packageList.id}" >${packageList.name}
								</li>
							</core:if>
						</core:forEach>
					</ul>
				</div>
				</core:forEach>
			</div>
			
			<div style="text-align: center;">
				<button type="button" id="submitSetting" class="btn btn-success">
					&nbsp;确&nbsp;&nbsp;定&nbsp;
				</button>
			</div>
		</form>
	</div>
</html>